﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LPPA.Facturacion.BusinessLayer;

namespace LPPA.Facturacion.UI.Views.Titulares
{
    public partial class TitularesHome : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            gvTitulares.DataSource = new TitularService().GetAll();
            gvTitulares.DataBind();

            gvTitulares.SelectedIndexChanged += gvTitulares_SelectedIndexChanged;
        }

        void gvTitulares_SelectedIndexChanged(object sender, EventArgs e)
        {
            var titularSelectedId =  gvTitulares.SelectedRow.Cells[1].Text;

            Response.Redirect(ResolveUrl("/Views/Titulares/TitularView.aspx?Id=" + titularSelectedId));
        }
    }
}